﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.DAL;
using AnyOffice.Components;
using AnyOffice.BIZ;


namespace AnyOffice.general.news.manage
{
    public partial class read_news : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int newsId = (Request.QueryString["news_id"] == null) ? 0 : int.Parse(Request.QueryString["news_id"].ToString());
            this.ViewState["NewsId"] = newsId;
            DataTable table = new NewsDao().SelectByNewsId(base.Conn, newsId, base.User.Identity.Name);
            if (table.Rows.Count == 0)
            {
                this.pnlMain.Visible = false;
                this.litMessage.Text = base.ShowPromptClose("无记录");
            }
            else
            {
                this.litSubject.Text = table.Rows[0]["Subject"].ToString();
                this.litTypeName.Text = table.Rows[0]["TypeName"].ToString();
                this.litUserName.Text = "<u title=\"部门：" + table.Rows[0]["DeptName"].ToString() + "\" style=\"CURSOR:hand\">" + table.Rows[0]["UserName"].ToString() + "</u>";
                this.litSendTime.Text = table.Rows[0]["SendTime"].ToString();
                if (table.Rows[0]["ViewCount"] != DBNull.Value)
                {
                    this.litViewCount.Text = table.Rows[0]["ViewCount"].ToString();
                }
                if (table.Rows[0]["Content"] != DBNull.Value)
                {
                    this.litContent.Text = table.Rows[0]["Content"].ToString();
                }
                if (table.Rows[0]["AttachmentId"] != DBNull.Value)
                {
                    string attachmentId = table.Rows[0]["AttachmentId"].ToString();
                    if ((this.litAttachment.Text = AttachmentBiz.Display(base.Conn, attachmentId)) != string.Empty)
                    {
                        this.pnlAttachment.Visible = true;
                    }
                    else
                    {
                        this.litAttachment.Text = "无";
                    }
                }
            }
        }

 

 

    }
}
